From 30fa0c4c1faece6b054105fe3cce5107f24a2fa2 Mon Sep 17 00:00:00 2001
From: Owen Jacobson <owen@grimoire.ca>
Date: Sun, 3 Nov 2024 15:33:43 -0500
Subject: Svelte 5: go through and use runes in components, pages, and layouts.

Does not use runes in stores (yet).
---
 ui/routes/(login)/invite/[invite]/+page.svelte | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

(limited to 'ui/routes/(login)/invite/[invite]/+page.svelte')

diff --git a/ui/routes/(login)/invite/[invite]/+page.svelte b/ui/routes/(login)/invite/[invite]/+page.svelte
index 8f4d1a4..65f5a97 100644
--- a/ui/routes/(login)/invite/[invite]/+page.svelte
+++ b/ui/routes/(login)/invite/[invite]/+page.svelte
@@ -4,14 +4,15 @@
 
 	import LogIn from '$lib/components/LogIn.svelte';
 
-	export let data;
+	let { data } = $props();
 
-	let username = '',
-		password = '';
+	let username = $state(''),
+		password = $state('');
 	let pending = false;
-	$: disabled = pending;
+	let disabled = $derived(pending);
 
-	async function onSubmit() {
+	async function onSubmit(event) {
+		event.preventDefault();
 		pending = true;
 		const response = await acceptInvite(data.invite.id, username, password);
 		if (200 <= response.status && response.status < 300) {
@@ -23,13 +24,13 @@
 	}
 </script>
 
-{#await data}
+{#await data.invite}
 	<div class="card m-4 p-4">
 		<p>Loading invitation…</p>
 	</div>
-{:then { invite }}
+{:then invite}
 	<div class="card m-4 p-4">
 		<p>Hi there! {invite.issuer} invites you to the conversation.</p>
 	</div>
-	<LogIn bind:disabled bind:username bind:password on:submit={onSubmit} />
+	<LogIn {disabled} bind:username bind:password onsubmit={onSubmit} />
 {/await}
-- 
cgit v1.2.3

